<?php
/**
 * Created by PhpStorm.
 * User: caipeichao
 * Date: 14-3-10
 * Time: PM9:01
 */

namespace Weibo\Model;
use Think\Model;

class WeiboModel extends Model {
    protected $_validate = array(
        array('content','1,99999','内容不能为空',self::EXISTS_VALIDATE,'length'),
        array('content','0,500','内容太长',self::EXISTS_VALIDATE,'length'),
    );

    protected $_auto = array(
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('status', '1', self::MODEL_INSERT),
    );

    public function addWeibo($uid, $content) {
        $data = array('uid'=>$uid,'content'=>$content);
        $data = $this->create($data);
        if(!$data) return false;
        return $this->add($data);
    }
}